<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <script type="text/javascript">

        class Car {
            // 创建实例时传入的参数，必须通过构造器方法接收
            constructor(name, price) {
                this.name = name
                this.price = price
            }
            // 类中直接写赋值语句的作用是，给实例对象添加属性，属性名为a，属性值为1
            a = 1
            wheel = 4
        }

        const c1 = new Car('奔驰', 199)
        const c2 = new Car("宝马", 299)
        console.log(c1)
        console.log(c2)

    </script>
</body>
</html>